﻿Public Class Packets

    Public Shared Sub LoginError(ByVal errorNo As Integer, ByVal packethandler As PacketHandler)
        Dim pc As New PacketCreator(packethandler.handler)
        pc.addInt(&HFE)
        pc.addInt(errorNo)
        pc.send()
    End Sub

    Public Shared Sub ServerList(ByVal user As String, ByVal packethandler As PacketHandler)
        Dim pc As New PacketCreator(packethandler.handler)
        pc.addInt(&HFD)
        pc.addByte(&HE6)
        pc.addByte(&HA8)
        pc.addByte(&H3E)
        pc.addByte(&H7B)
        pc.addByte(1)
        pc.addString(user)
        pc.addInt(&H25)
        Dim cluster As New Cluster
        Dim i As Integer = 0
        For Each obj As Object In ISC.clusters
            cluster = obj
            pc.addInt(-1)
            pc.addInt(i) '[int] Cluster ID
            pc.addString(cluster.name)
            pc.addString(cluster.ip)
            pc.addInt(0)
            pc.addInt(0)
            pc.addInt(1)
            pc.addInt(0)
            Dim channel As String
            Dim t As Integer = 0
            For Each myObj In cluster.channels
                channel = cluster.channels.Item(t)
                pc.addInt(i) '[int] Cluster ID
                pc.addInt(t) '[int] Server ID
                pc.addString(channel)
                pc.addInt(0)
                pc.addInt(0)
                pc.addInt(0) '[int] Online players
                pc.addInt(1)
                pc.addInt(1100) '[int] Capacity
                t += 1
            Next
            i += 1
        Next
        pc.send()
    End Sub

End Class

